<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>迎聘后台管理系统</title>

    <#-- request.contextPath=http://localhost:1488/  -->
    <#assign base=request.contextPath  />

    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <style>
        #win10-login {
            background: url('${base}/static/win10/img/main.png') no-repeat fixed;
            width: 100%;
            height: 100%;
            background-size: 100% 100%;
            position: fixed;
            z-index: -1;
            top: 0;
            left: 0;
        }

        #win10-login-box {
            width: 300px;
            overflow: hidden;
            margin: 100px auto;
        }

        .win10-login-box-square {
            width: 105px;
            margin: 0 auto;
            border-radius: 50%;
            background-color: darkgray;
            position: relative;
            overflow: hidden;
        }

        .win10-login-box-square::after {
            content: "";
            display: block;
            padding-bottom: 100%;
        }

        .win10-login-box-square .content {
            position: absolute;
            width: 100%;
            height: 100%;
        }

        input {
            width: 90%;
            display: block;
            border: 0;
            margin: 0 auto;
            line-height: 36px;
            font-size: 20px;
            padding: 0 1em;
            border-radius: 5px;
            margin-bottom: 11px;
        }

        .login-username, .login-password {
            width: 91%;
            font-size: 13px;
            color: #000000;
            background-color: #ffffff;
        }

        .login-password {
            width: calc(91% - 54px);
            -webkit-border-radius: 2px 0 0 2px;
            -moz-border-radius: 2px 0 0 2px;
            border-radius: 5px 0 0 5px;
            margin: 0px;
            float: left;
        }

        .login-submit {
            margin: 0px;
            float: left;
            -webkit-border-radius: 0 5px 5px 0;
            -moz-border-radius: 0 5px 5px 0;
            border-radius: 0 5px 5px 0;
            background-color: #009688;
            width: 54px;
            display: inline-block;
            height: 36px;
            line-height: 36px;
            padding: 0 auto;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            cursor: pointer;
            opacity: .9;
            filter: alpha(opacity=90);

        }
    </style>
</head>
<body>
<script>
    //控制跳出ifream框架
    if (window != top)
        top.location.href = location.href;
</script>
<div id="win10-login">
    <div style="height: 10%;min-height: 120px"></div>
    <div id="win10-login-box">
      <#--  <div class="win10-login-box-square">
            <img src="${base}/static/win10/img/avatar.png" class="content"/>
        </div>-->
        <br>    <br>
        <p style="font-size: 24px;color: #ffffff;text-align: center">迎聘后台管理系统</p>
        <br>
        <br>
        <form target="_self" method="get" action="#">
            <!--用户名-->
            <input type="text"  id="account"   placeholder="请输入登录名" class="login-username">
            <!--密码-->
            <input type="password"   id="password" placeholder="请输入密码" class="login-password">
            <!--登陆按钮-->
            <button type="button"   id="btn-login" class="login-submit">登录</button>

        </form>

        <br>


    </div>
</div>
<script src="${base}/static/win10/component/layui/layui.js"></script>
<script src="${base}/static/win10/js/jquery-2.2.4.min.js"></script>
<script>
    layui.use(['form', 'layer'], function() {


        var form = layui.form;
        $("#editPass").on("click",function(){
            //示范一个公告层
            layer.open({
                type: 1
                ,title: false //不显示标题栏
                ,closeBtn: false
                ,area: '300px;'
                ,shade: 0.8
                ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
                ,btn: ['确定修改', '关闭']
                ,btnAlign: 'c'
                ,moveType: 1 //拖拽模式，0或者1
                ,content:
                    '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' +
                     ' <form target="_self" method="get" action="#">' +
                    '            <!--用户名-->' +
                    '            <input type="text" id="email"   placeholder="请输入邮箱" class="login-username">' +
                    '      <button id="sendEmail" type="button" class="layui-btn  layui-btn-sm">验证邮箱</button>'+
                    '            <input type="password" id="pass"   placeholder="请输入新密码" class="login-username">' +
                    '            <input type="password" id="reloadPass"   placeholder="请再次输入新密码" class="login-username">' +

                    '            <input type="text" id="code"   placeholder="请输入邮箱验证码" class="login-username">' +
                    '        </form>'+
                    '</div>'
                ,yes: function(){
                    if($("#reloadPass").val()!=$("#pass").val()){
                        layer.msg("两次密码不一样");
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url:  "${base}/WeChatUser/user/admin/editPass",
                        data: {
                            "email": $("#email").val(),
                            "passWord": $("#reloadPass").val(),
                            "code": $("#code").val()
                        },
                        success: function (data) {
                            layer.msg(data.msg)
                        }
                    });
                }
                ,success:function (layero){
                    $("#sendEmail").on("click",function () {
                        $.ajax({
                            beforeSend: function () {
                                $("#sendEmail").attr("class", "layui-btn layui-btn layui-btn-sm layui-btn-disabled")
                                $("#sendEmail").html('<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>')
                            },
                            type: "POST",
                            url:  "${base}/WeChatUser/user/admin/editPassSendMail",
                            data: {
                                "email": $("#email").val(),
                                "passWord": $("#reloadPass").val()
                            },
                            success: function (data) {
                                $("#sendEmail").html("验证邮箱");
                                $("#sendEmail").attr("class", "layui-btn layui-btn layui-btn-sm ")
                                layer.msg(data.msg)
                            }
                        });
                    })
                }
            });
        })

        $("#btn-login").on("click",function () {
              var sysType=$('input[name="sysType"]:checked').val();
            if ($("#account").val() == "") {
                layer.msg("账户不能为空")
                return;
            }
            if ($("#password").val() == "") {
                layer.msg("密码不能为空")
                return;
            }
            $.ajax({
                type: "POST",
                url:  "${base}/WeChatUser/user/admin/login",
                data: {
                    "account": $("#account").val(),
                    "passWord": $("#password").val()
                },

                success: function (data) {
                    console.log(data)
                    if (data.code== 200 && data.data.userAdmin==1) {
                        window.location.href = "${base}/index.html"
                    } else {
                        layer.msg(data.message)
                    }
                }
            });
        })
    })

</script>
</body>
</html>